package com.aramis.mydytt.ui.topic

import androidx.lifecycle.MutableLiveData
import com.aramis.mydytt.ui.base.BaseViewModel
import com.aramis.mydytt.ui.bean.MovieSpecialBean
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers

class MainTopicViewModel : BaseViewModel() {

    val topicListData = MutableLiveData<List<MovieSpecialBean>?>()

    fun getSearchResult(page: Int = 1) {
        compositeDisposable.add(
            movieApi.getSpecialList(page)
                .subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe({
                    topicListData.postValue(it?.data)
                }, {
                    topicListData.postValue(null)
                })
        )
    }
}